package com.yzzrjy.util;

import java.util.Arrays;
import java.util.List;

public class StringUtil {
    public static String formatStringBySymbol(List<String> list, String symbol){
        String retStr = "";
        if(list == null || list.size() == 0){
            return retStr;
        }
        StringBuilder stringBuilder = new StringBuilder();
        for(String str : list){
            stringBuilder.append(str);
            stringBuilder.append(symbol);
        }
        retStr = stringBuilder.toString();
        if(retStr.endsWith(symbol)){
            retStr = retStr.substring(0, retStr.length() - symbol.length());
        }
        return retStr;
    }
    public static List<String> deFormatStringBySymbol(String string, String symbol){
        List<String> retList = null;
        if(string != null) {
            retList = Arrays.asList(string.split(symbol));
        }
        return retList;
    }
}
